Skip to content

Add filter to hide AI Content Planner inline banner#23232

Merged
pls78 merged 1 commit intorelease/27.6from
1196-add-filter-to-have-the-option-to-hide-inline-banner
May 5, 2026
Merged

Add filter to hide AI Content Planner inline banner#23232
pls78 merged 1 commit intorelease/27.6from
1196-add-filter-to-have-the-option-to-hide-inline-banner

Conversation

@thijsoo
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo commented May 5, 2026

Context

Site owners might want a way to hide the AI Content Planner inline banner from the post editor without per-post dismissal.

Summary

This PR can be summarized in the following changelog entry:

  • Adds the wpseo_enable_ai_content_planner_inline_banner filter to hide the AI Content Planner inline banner from the post editor.

Relevant technical choices:

  • The filter gates the Meta_Fields_Presenter('content_planner') call in the metabox: returning false stops the hidden post-meta inputs from rendering at all.
  • The editor JS now treats an absent yoast_wpseo_is_content_planner_banner_dismissed input as "banner disabled" by checking the input element's existence instead of comparing its value to "1".
  • The "Get content suggestions" sidebar/metabox button is unaffected — only the inline banner is hidden.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  1. On a clean install with the AI Content Planner feature available, edit a new post in the block editor. The "AI Content Planner" inline banner appears above the first block (requires at least 5 published posts).
  2. Add the following snippet to a mu-plugin or your theme's functions.php:
    add_filter( 'wpseo_enable_ai_content_planner_inline_banner', '__return_false' );
  3. Reload the post editor. The inline banner is no longer rendered, and the hidden input yoast_wpseo_is_content_planner_banner_dismissed is absent from the page source.
  4. Open the Yoast sidebar / metabox. The "Get content suggestions" button is still present and functional.
  5. Remove the filter. Reload the editor. The banner is back on new posts.
  6. Verify dismissed posts: dismiss the banner on a post (with the filter removed), reload — the banner stays hidden for that post. Add the filter, reload — still hidden. Remove the filter, reload — still hidden (per-post dismissal preserved).

Relevant test scenarios

  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • The AI Content Planner inline banner JS bootstrap (packages/js/src/ai-content-planner/helpers/fields.js) — the dismissal-state seed now reads the input element directly. Per-post dismiss/re-render flows are unchanged.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and committed the results, if my PR introduces or edits images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes Yoast/reserved-tasks#1196

Add wpseo_enable_ai_content_planner_inline_banner so site owners can
hide the AI Content Planner inline banner from the editor via PHP.
Returning false short-circuits the hidden meta inputs that the metabox
renders for the content_planner field group; the editor JS now treats
an absent input as "banner disabled" by reading the input element
directly instead of comparing its value to "1".

Per-post dismissal and the metabox save pipeline are untouched, so DB
values survive a toggle of the filter.

Refs Yoast/reserved-tasks#1196

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thijsoo thijsoo added innovation Innovative issue. Relating to performance, memory or data-flow. changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog labels May 5, 2026
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 12426

Coverage decreased (-3.1%) to 53.516%

Details

  • Coverage decreased (-3.1%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (3 of 5 lines covered, 60.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
admin/metabox/class-metabox.php 2 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 66117
Covered Lines: 35251
Line Coverage: 53.32%
Relevant Branches: 16977
Covered Branches: 9218
Branch Coverage: 54.3%
Branches in Coverage %: Yes
Coverage Strength: 45497.03 hits per line

💛 - Coveralls

@pls78 pls78 added this to the 27.6 milestone May 5, 2026
Copy link
Copy Markdown
Member

@pls78 pls78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR && Acc: ✅

@pls78 pls78 merged commit cee2d89 into release/27.6 May 5, 2026
41 of 42 checks passed
@pls78 pls78 deleted the 1196-add-filter-to-have-the-option-to-hide-inline-banner branch May 5, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants